<?php

namespace IDock\Insurance\JDAL\Request;

use Exception;
use IDock\Insurance\JDAL\Bean\BasePremiumInquiry;
use IDock\Insurance\JDAL\Response\VehicleInfoCheckResponse;
use IDock\Visitor\Premium\PremiumInquiryVisitor;

class VehicleInfoCheckRequest extends AllJDALRequest
{
    public $route = 'underwriting/vehicleInfoCheck';

    public $requestCode = 'quoteCreateRequest';

    protected $response = VehicleInfoCheckResponse::class;

    protected $urlTip = '前置校验';

    /*** @var  PremiumInquiryVisitor $visitor */
    protected $visitor;

    /*** @var BasePremiumInquiry $basePremiumInquiry */
    public $basePremiumInquiry;

    /**
     * @return array
     * @throws Exception
     */
    public function generate(): array
    {
        $this->partnerRef = $this->basePremiumInquiry->partnerRef;

        return [
            'basePart' => $this->basePremiumInquiry->basePart,
            'vehicle' => $this->basePremiumInquiry->vehicle,
            'owner' => $this->basePremiumInquiry->owner,
            'policyParties' => $this->basePremiumInquiry->policyParties,
        ];
    }
}
